package com.mvvm.ktnet.ui.testViewPager2

import androidx.annotation.NonNull
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity

import androidx.viewpager2.adapter.FragmentStateAdapter


class LazyFragmentPagerAdapter(
    @NonNull fragmentActivity: FragmentActivity,
    val fragments: List<Fragment>,
) : FragmentStateAdapter(fragmentActivity) {

    @NonNull
    override fun createFragment(position: Int): Fragment {
        return fragments[position]
    }

    override fun getItemCount(): Int {
        return fragments.size
    }
}